Skip to content

dgb: bind AutoRatchet {mint,vote} selector to the share-mint path (Phase B) - #294

Merged
frstrtr merged 1 commit into
dgb/auto-ratchet-wire-base35from
dgb/run-loop-mint-bind
Jun 21, 2026
Merged

dgb: bind AutoRatchet {mint,vote} selector to the share-mint path (Phase B)#294
frstrtr merged 1 commit into
dgb/auto-ratchet-wire-base35from
dgb/run-loop-mint-bind

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Phase B pool/share. Closes the gap integrator flagged: the {mint,vote} selector finally gets a live create_local_share() caller bound.

What

  • New src/impl/dgb/run_loop_mint.hpp :: mint_local_share_with_ratchet(ratchet, tracker, best_share, createFn) — asks dgb_select_mint_versions for the {share_version, desired_version} pair and forwards it into the create step, replacing the hardcoded 36/36 default on create_local_shares trailing version args.
  • Header-only; the create step is INJECTED so this glue stays off the ~30-arg create_local_share surface (the run-loop binds every other field; this helper only chooses+forwards the version pair).

Why it matters

A freshly-started VOTING node now mints DGB baseline 35 while voting 36 — it cannot skip ahead of the older DGB sharechain (oracle 22761e7, SUCCESSOR=None). No new policy: get_share_version still owns the work-weighted 60%-gate (#249/#289).

Tests

+2 KAT in dgb_share_test, 24/24 green:

  • pair threaded, not hardcoded (35 != 36 proves both fields independent)
  • create-step result returned verbatim
  • stamp stable while VOTING

Landing

Stacked on #293 (needs auto_ratchet_wire.hpp). Order: 292 -> 293 -> this; rebase to master once the 292->293 stack lands. Consensus-adjacent (selects minted version) -> surface-for-tap, HOLD, no self-merge.

Phase B pool/share. run_loop_mint.hpp::mint_local_share_with_ratchet is the
live create_local_share() caller seam: it asks dgb_select_mint_versions for the
{share_version, desired_version} pair and forwards it to an injected create
step, replacing the previously hardcoded 36/36 default. A bootstrap VOTING node
now mints the DGB baseline 35 while voting 36, so it cannot skip ahead of the
older DGB sharechain. No new policy: get_share_version owns the work-weighted
gate. Header-only, injected create step keeps it off the ~30-arg create surface.

+2 KAT in dgb_share_test (24/24): version pair threaded not hardcoded (35!=36
proves both fields independent), result returned verbatim, stamp stable while
VOTING.
@frstrtr
frstrtr merged commit 2f252e4 into dgb/auto-ratchet-wire-base35 Jun 21, 2026
20 checks passed
frstrtr added a commit that referenced this pull request Jun 21, 2026
…ssify->dispatch) [#82 leg-2 / Stage 4d]

Replace the Stage-4a mining_submit stub with the live hot path. Reconstruct
the 80-byte DGB block header from the JobSnapshot + miner inputs (coinbase =
coinb1||en1||en2||coinb2; merkle ascent from the coinbase txid; header =
version|prev|merkle|ntime|nbits|nonce, all little-endian / prevhash reversed
to internal order), run the DGB-Scrypt PoW digest through the #286 scrypt_pow
SSOT, expand both compact targets via compact_to_target, and classify via the
Stage-4d submit_classify SSOT (tighten-first):

  WonBlock    -> serialize the full block (BIP144 coinbase witness when segwit
                 active) and hand it to the dual-path broadcaster submit_block_fn
                 (P2P relay + submitblock RPC fallback, #82); scream-never-drop
                 on a won block that reaches no sink.
  ShareAccept -> forward the found-share fields to try_mint_share (the #295
                 producer seam -> #294 mint bind); degrades to accepted-without-
                 credit when no mint fn is wired (no silent drop).
  Reject      -> stratum low-difficulty error.

work_source.cpp / work_source_test.cpp only; per-coin isolation held. The
header layout is byte-for-byte Bitcoin (only the PoW digest differs, Scrypt);
no share format, coinbase commitment, or PPLNS math touched -> p2pool-merged-v36
surface NONE. +3 KATs pin the three-way ladder dispatch by job targets (23/23).
frstrtr added a commit that referenced this pull request Jun 21, 2026
…ssify->dispatch) [#82 leg-2 / Stage 4d] (#297)

Replace the Stage-4a mining_submit stub with the live hot path. Reconstruct
the 80-byte DGB block header from the JobSnapshot + miner inputs (coinbase =
coinb1||en1||en2||coinb2; merkle ascent from the coinbase txid; header =
version|prev|merkle|ntime|nbits|nonce, all little-endian / prevhash reversed
to internal order), run the DGB-Scrypt PoW digest through the #286 scrypt_pow
SSOT, expand both compact targets via compact_to_target, and classify via the
Stage-4d submit_classify SSOT (tighten-first):

  WonBlock    -> serialize the full block (BIP144 coinbase witness when segwit
                 active) and hand it to the dual-path broadcaster submit_block_fn
                 (P2P relay + submitblock RPC fallback, #82); scream-never-drop
                 on a won block that reaches no sink.
  ShareAccept -> forward the found-share fields to try_mint_share (the #295
                 producer seam -> #294 mint bind); degrades to accepted-without-
                 credit when no mint fn is wired (no silent drop).
  Reject      -> stratum low-difficulty error.

work_source.cpp / work_source_test.cpp only; per-coin isolation held. The
header layout is byte-for-byte Bitcoin (only the PoW digest differs, Scrypt);
no share format, coinbase commitment, or PPLNS math touched -> p2pool-merged-v36
surface NONE. +3 KATs pin the three-way ladder dispatch by job targets (23/23).

Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
frstrtr added a commit that referenced this pull request Jun 23, 2026
…ssify->dispatch) [#82 leg-2 / Stage 4d] (#297)

Replace the Stage-4a mining_submit stub with the live hot path. Reconstruct
the 80-byte DGB block header from the JobSnapshot + miner inputs (coinbase =
coinb1||en1||en2||coinb2; merkle ascent from the coinbase txid; header =
version|prev|merkle|ntime|nbits|nonce, all little-endian / prevhash reversed
to internal order), run the DGB-Scrypt PoW digest through the #286 scrypt_pow
SSOT, expand both compact targets via compact_to_target, and classify via the
Stage-4d submit_classify SSOT (tighten-first):

  WonBlock    -> serialize the full block (BIP144 coinbase witness when segwit
                 active) and hand it to the dual-path broadcaster submit_block_fn
                 (P2P relay + submitblock RPC fallback, #82); scream-never-drop
                 on a won block that reaches no sink.
  ShareAccept -> forward the found-share fields to try_mint_share (the #295
                 producer seam -> #294 mint bind); degrades to accepted-without-
                 credit when no mint fn is wired (no silent drop).
  Reject      -> stratum low-difficulty error.

work_source.cpp / work_source_test.cpp only; per-coin isolation held. The
header layout is byte-for-byte Bitcoin (only the PoW digest differs, Scrypt);
no share format, coinbase commitment, or PPLNS math touched -> p2pool-merged-v36
surface NONE. +3 KATs pin the three-way ladder dispatch by job targets (23/23).

Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
frstrtr added a commit that referenced this pull request Jun 23, 2026
…mer seam

Re-lands the #294 mint_local_share_with_ratchet helper, which was lost from
master in the #292/#293/#294 stacked squash-merge (no #294 merge commit reaches
origin/master; the primitives dgb_select_mint_versions + create_local_share
survive). This is the consumer adapter DGBWorkSource::MintShareFn binds to
(work_source.hpp:197): on a ShareAccept submission it parses the 80-byte
reconstructed header, asks the live AutoRatchet for the {mint, vote} version
pair, and inserts the share via create_local_share, returning the minted hash
(NULL on a malformed header / fail-closed).

Authored against master createlocal_share signature (authoritative). Duck-typed
on the inputs so the header does not pull the stratum work_source TU in. Pure
adapter: tracker-insertion thread-safety is the caller bind point concern.

KAT (dgb_share_test, no new exe): 80-byte header parse round-trip, short-buffer
fail-closed, and adapter fail-closed + template instantiation drift-guard
against create_local_share. 25/25 green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant